<template>
  <div>
    <div class="topicInfo">
      <div class="top-img">
        <a href="javascript:;">
          <img
            :src="actObj.imgSrc"
            alt=""/>
        </a>
      </div>
      <div class="bot-info">
        <h3>
          <a href="javascript:;">{{actObj.title}}</a>
        </h3>
        <p>
          <span
          ref="sp"
          >{{isOpen}}</span>
        </p>
        <p>
          <span 
          v-if="!actObj.isOpen"
          class="iconfont icon-clock"></span>
          <span>{{actObj.time}}</span>
        </p>
      </div>
    </div>
  </div>
</template>

<script>
export default {
    props:{
        actObj:{
            type:Object
        }
    },
    name:"Act",
    data(){
      return{
        isOpen: '',
      }
    },
    methods:{
      isOp(){
        if(this.actObj.isOpen == false){
          this.isOpen = "已结束";
          this.$refs.sp.style['background'] = '#ccc';
        }else{
          this.isOpen = "展映中";
          this.$refs.sp.style['background'] = '#3498db';
        }
      }
    },
    mounted(){
      this.isOp();
    }
};
</script>

<style lang="scss" scoped>
.topicInfo {
    margin-top: 20px;
  .top-img {
    width: 380px;
    height: 198px;
    a {
      display: block;
      width: 100%;
      height: 100%;
      img {
        width: 100%;
        height: 100%;
      }
    }
  }
  .bot-info {
    background-color: #fff;
    padding: 10px 16px 10px 16px;
    box-sizing: border-box;
    height: 140px;
    h3 {
      a {
        font-size: 18px;
      }
    }
    p:nth-child(2) {
      margin: 10px 0 0 8px;
      span {
        color: #fff;
        padding: 2px 6px;
        font-size: 14px;
      }
    }
    p:nth-child(3) {
      margin-top: 8px;
      span {
        vertical-align: middle;
      }
      span:nth-child(1) {
        margin-right: 10px;
        color: #ccc;
        font-size: 18px;
      }
      span:nth-child(2) {
        font-size: 14px;
        color: #666;
      }
    }
  }
}
</style>